package com.sky.ok.okex.websocket.client;


import com.sky.ok.okex.websocket.base.BuissnesWebSocketServiceImpl;

import static com.sky.ok.okex.common.OKV3Const.WEBSOCKET_ADRESS_V3;

/**
 * 创建webSocket客户端
 * @author 余心乐sky
 * @create 2019-05-20 9:47
 **/
public class WebSocketV3 {

    // 订阅消息处理类,用于处理WebSocket服务返回的消息
    private static WebSocketService service = new BuissnesWebSocketServiceImpl();

    // WebSocket客户端
    private static WebSoketClient client;

    // 通过单例启动客户端
    public static synchronized WebSoketClient getInstance(){
        if(client == null ){
            client = new WebSoketClient(WEBSOCKET_ADRESS_V3, service);
            client.start();
        }

      return client;
    };

    public static void setClient(WebSoketClient client) {
        WebSocketV3.client = client;
    }
}
